package com.linkhub.oms.data.sync.api.wms.domain.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.linkhub.oms.common.util.QtOptionalUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: EntryOrderBatchCreateResponse
 * @Author: Jaycle
 * @Date: 2024/5/5 21:15
 * @Version: 1.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class EntryOrderBatchCreateResponse extends WmsBaseResponse implements Serializable {

    /**
     * response
     */
    @JSONField(name = "response")
    private Response response;

    @Override
    protected String getFlag() {
        return QtOptionalUtil.of(response)
                .map(Response::getFlag)
                .orElse(null);
    }

    /**
     * Response
     */
    @Data
    @NoArgsConstructor
    public static class Response {
        /**
         * flag
         */
        @JSONField(name = "flag")
        private String flag;
        /**
         * code
         */
        @JSONField(name = "code")
        private String code;
        /**
         * message
         */
        @JSONField(name = "message")
        private String message;
        /**
         * entryOrderId
         */
        @JSONField(name = "entryOrderId")
        private String entryOrderId;

        /**
         * orders
         */
        @JSONField(name = "orders")
        private Orders orders;
    }

    @Data
    @NoArgsConstructor
    public static class Orders {
        /**
         * order列表
         */
        @JSONField(name = "order")
        private List<Order> order;
    }

    @Data
    @NoArgsConstructor
    public static class Order {
        /**
         * 入库单号
         */
        @JSONField(name = "entryOrderCode")
        private String entryOrderCode;
        /**
         * 消息
         */
        @JSONField(name = "message")
        private String message;
    }
}
